package com.example.myapplication.room;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao     //   增删改查 操作
public interface StudentDao {

    @Insert
    void insertWords(Student... students);

    @Update
    void updateWords(Student... students);

    /**
     * 条件删除
      * @param students
     */
    @Delete
    void deleteWrods(Student... students);

    /**
     * 全部删除     @Query  里面什么语句都可以写
     */
    @Query("DELETE FROM student" )//  删除
    void deleteAllWords();

    /**
     *  查询全部
     * @return
     */
    @Query("SELECT * FROM student ORDER BY ID DESC")
     LiveData<List<Student>> getAllStudentLive();




}
